#include "SQLAnyExpr.h"
#include "../../visitor/SQLASTVisitor.h"

SQLAnyExpr::SQLAnyExpr(){

}

SQLAnyExpr::~SQLAnyExpr(){
	// if (subQuery != nullptr)
	// {
	// 	// delete subQuery;
	// 	subQuery = nullptr;
		
	// }
}
SQLAnyExpr::SQLAnyExpr(SQLSelect_ptr theSelect){

	subQuery = theSelect;
}

SQLSelect_ptr SQLAnyExpr::getSubQuery() {
	return subQuery;
}

void SQLAnyExpr::setSubQuery(SQLSelect_ptr  theSubQuery) {
	subQuery = theSubQuery;
}

void SQLAnyExpr::output(std::stringstream *  buf) {
	//this.subQuery.output(buf);
	subQuery->output(buf);
}

void SQLAnyExpr::accept0(SQLASTVisitor_ptr visitor) {
	if (visitor->visit(SharedObject(SQLAnyExpr))) {
		acceptChild(visitor, subQuery);
	}

	visitor->endVisit(SharedObject(SQLAnyExpr));
}

//int SQLAnyExpr::hashCode() {
	//final int prime = 31;
	//int result = 1;
	//result = prime * result + ((subQuery == null) ? 0 : subQuery.hashCode());
	//return result;
//}

//BOOL_ptr SQLAnyExpr::equals(Object obj) {
	//if (this == obj) {
		//return BOOL::TRUE;
	//}
	//if (obj == null) {
		//return BOOL::FALSE;
	//}
	//if (getClass() != obj.getClass()) {
		//return BOOL::FALSE;
	//}
	//SQLAnyExpr other = (SQLAnyExpr) obj;
	//if (subQuery == null) {
		//if (other.subQuery != null) {
			//return BOOL::FALSE;
		//}
	//} else if (!subQuery.equals(other.subQuery)) {
		//return BOOL::FALSE;
	//}
	//return BOOL::TRUE;
//}

